package com.example.android_20190529_01;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btn_LinearLayout).setOnClickListener(this);
        findViewById(R.id.btn_RelativeLayout).setOnClickListener(this);
        findViewById(R.id.btn_GridLayout).setOnClickListener(this);
        findViewById(R.id.btn_FrameLayout).setOnClickListener(this);
        findViewById(R.id.btn_TableLayout).setOnClickListener(this);
    }
//    点击按钮跳转界面
    @Override
    public void onClick(View view)
    {
        Intent intent=new Intent();
        switch (view.getId()){
            case R.id.btn_LinearLayout:
                intent.setClass(this,LinearLayoutActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_RelativeLayout:
                intent.setClass(this,RelativeLayoutActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_TableLayout:
                intent.setClass(this,TableLayoutActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_GridLayout:
                intent.setClass(this,GridLayoutActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_FrameLayout:
                intent.setClass(this,FrameLayoutActivity.class);
                startActivity(intent);
                break;
        }
    }
}
